package au.com.fx.contact;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

public class GAESigningUpUserRepository implements SigningUpUserRepository {

	@Override
	public void save(SigningUpUser user) {
		EntityManager entityManager = EMF.get().createEntityManager();
		try {
			entityManager.persist(user);
			System.out.println("user id is " + user.getName());
		} finally {
			entityManager.close();
		}
	}
	
	@Override
	public List<SigningUpUser> getAll() {
		EntityManager entityManager = EMF.get().createEntityManager();
		Query query = entityManager.createQuery("select from SigningUpUser");
		List<SigningUpUser> userList = query.getResultList();
		return userList;
	}
	
	

}
